<% @main_header = "#{link_to('Ptrack:', '/')} Edit Project :" "#{@project.name}" %>
<% @title = "Edit Project  " %>


<%= error_messages_for 'project',:header_message=>nil,:class=>'error' %>
<%= display_messages_for_all %>

<% form_for @project, :url => {:action => 'update'} do |f| %>
  <table>
    <tr>
      <td><%= f.label 'name', 'Project Name:',:class=>'required' %></td>
      <td> <%= f.text_field 'name', :size => 40 %></td>
    </tr>
    <tr>
      <td><%= f.label 'abbr', 'Project Short Name:' %></td>
      <td> <%= f.text_field 'abbr', :size => 20 %></td>
    </tr>
    <tr>
      <td><%= f.label 'description', 'Description:' %></td>
      <td> <%= f.text_area 'description', :style => "height: 60px; width: 250px" %></td>
    </tr>
    <tr>
      <td><%= f.label 'start_date', 'Start Date:' %></td>
      <td><%= f.text_field 'start_date', :id => 'start_date',:size=>20 %></td>
    </tr>
    <tr>
      <td><%= f.label 'end_date', 'Due Date:' %></td>
      <td><%= f.text_field 'end_date', :size => 20, :id => 'end_date' %></td>
    </tr>
    <tr>
      <td><%= f.label 'contract_date', 'Contract Date:' %></td>
      <td><%= f.text_field 'contract_date', :size => 20, :id => 'contract_date' %></td>
    </tr>
    <tr>
      <td><%= f.label 'fee', 'Fee:' %></td>
      <td><%= f.text_field 'fee', :size => 20 %></td>
    </tr>
    <tr>
      <td><%= f.label 'currency', 'Fee Currency:' %></td>
      <td><%= f.select 'currency',[['TL','TL'],['USD','USD'],['EUR','EUR']]%></td>
    </tr>
    <tr>
      <td><%= f.label 'currency_rate', 'Currency Rate:' %></td>
      <td><%= f.text_field 'currency_rate', :size => 5 %></td>
    </tr>
    <tr>
      <td><%= f.label 'keywords', 'Keywords:' %></td>
      <td><%= f.text_field 'keywords', :size => 20 ,:maxlength=>255%></td>
    </tr>
    <tr>
      <td><%= f.label 'pattern', 'Project Pattern'%></td>
      <td>
        <%= select("project_pattern", "id", Pattern.find(:all).collect {|p| [ p.title, p.id ] }, {:selected=>@pattern_id.to_i, :include_blank => true }, :onchange => remote_function(
            :url => {:controller=>:patterns ,:action => :show_pattern_phases},
            :update => "pattern_phases",
            :with => "'id=' + this.value")) %><%= check_box("project_pattern", "new" ) %> Save as New Project Pattern?
      </td>
    </tr>
    <tr>
      <td valign="top"><%= label_tag 'Phases' %></td>
      <td valign="top">
        <ul id="pattern_phases">
          <%= render :partial => 'patterns/phase_input', :locals=>{:phases=>@pattern_phases} %>
        </ul>
        <%= sortable_element 'pattern_phases',
          :complete => visual_effect(:highlight, 'pattern_phases')
      %>
        <%= link_to_remote  image_tag('/images/add.png') + "Add A Phase" ,
          :update => "pattern_phases",
          :url => {:controller=>:patterns, :action => :add_phase },
          :position => "bottom"
      %>
      </td>
    </tr>
    <tr>
      <td colspan="2"><%= submit_tag 'Update' %></td>
    </tr>
  </table>
<% end %>